package com.multidisplay.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.multidisplay.mapper.DisplayListMapper;
import com.multidisplay.mapper.VideoDisareaMapper;
import com.multidisplay.po.DisplayList;
import com.multidisplay.po.VideoDisarea;
import com.multidisplay.service.DisplayListService;
import com.multidisplay.service.VideoDisareaService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("VideoDisareaService")
public class VideoDisareaServiceImpl implements VideoDisareaService {
    @Resource
    private VideoDisareaMapper videoDisareaMapper;

    @Override
    public void add(VideoDisarea videoDisarea) {
        videoDisareaMapper.insert(videoDisarea);
    }

    @Override
    public void delById(int id) {
        QueryWrapper<VideoDisarea> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",id);

        videoDisareaMapper.delete(queryWrapper);
    }

    @Override
    public List<VideoDisarea> selectById(int id) {
        QueryWrapper<VideoDisarea> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id",id);
        List<VideoDisarea> videoDisareas = videoDisareaMapper.selectList(queryWrapper);
        return videoDisareas;
    }

    @Override
    public List<VideoDisarea> selectByCategory(String category) {
        QueryWrapper<VideoDisarea> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("category",category);
        List<VideoDisarea> videoDisareas = videoDisareaMapper.selectList(queryWrapper);
        return videoDisareas;
    }

    @Override
    public List<VideoDisarea> selectAll() {
        List<VideoDisarea> videoDisareas = videoDisareaMapper.selectList(null);
        return videoDisareas;
    }

    @Override
    public void update(VideoDisarea videoDisarea) {
        videoDisareaMapper.update(videoDisarea,null);
    }
}
